#ifndef __LAVALAMP_PROVIDER_H__
#define __LAVALAMP_PROVIDER_H__

#include "../interface/TickerContentIF.h"
#include "../urlparse/urlparse.h"

#define MAX_CCIS 1024
#define INVALID_THREAD (unsigned long)(-1)
#define DEFAULT_UPDATE_INTERVAL 60 //in seconds

class CLavalampProvider : public INewsContentProvider
{
public:
	CLavalampProvider();
	virtual ~CLavalampProvider();

	virtual void GetNextNewsItem(NewsItem** ppItem);
	virtual void Tick();
	virtual size_t GetURLSize();
	// GetURL, on success returns 0, otherwise -1. 
	virtual int GetURL(char* url_buf, size_t bufsize);

	void WebFetched(char* szFilename);
	void SetUpdateInterval (int nMinutes);
	void ShowAllSuccessfulItems(bool bShow);
	void SetAllPass();

protected:
	NewsItem m_items[MAX_CCIS];
	int m_nCount;
	int m_nIdx;
	unsigned long m_uThreadID;
	int m_nUpdateInterval; // in seconds.
	int m_nClock;
	bool m_bShowSuccesses;

public:
   HANDLE   m_hMutex;
   CURLParser  m_parser;

protected:
	void SetNoContent();
	void FreeItems();
	void AddItem (char* txt, int nIdx);
};

#endif /* __LAVALAMP_PROVIDER_H__ */